package com.sfac.day02.modules.common.entity;

public class SearchBean {
    private final static Integer DEFAULT_CURRENT_PAGE = 1;
    private final static Integer DEFAULT_PAGE_SIZE = 5;
    private Integer pageNumber;
    private Integer pageSize;
    private String orderBy;
    private String direction;
    private String keyword;

    public void initSearchBean() {
        if (this != null) {
            this.setPageNumber(this.getPageNumber() == 0 ? DEFAULT_CURRENT_PAGE : this.getPageNumber());
            this.setPageNumber(this.getPageNumber() == 0 ? DEFAULT_PAGE_SIZE : this.getPageNumber());
        }
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }
}